import numpy as np # linear algebra
import pandas as pd  # data processing, CSV file I/O
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv("boston_housing.csv")

print(df.head()) #显示前5行
print(df.shape)
print(df.columns)
df.describe()
print(df["MEDV"])
# 目标y（房屋价格）的直方图／分布
fig = plt.figure()
sns.distplot(df["MEDV"], bins=30, kde=True)
plt.xlabel("Median value of owner-occupied homes", fontsize=12)

_, axes = plt.subplots(1, 2, sharey=True, figsize=(6, 4))
sns.boxplot(data=df["MEDV"], ax=axes[0])
sns.violinplot(data=df["MEDV"], ax=axes[1])
plt.show()